/*
day445 
2020.11.15 
*/
#include<iostream>
#include<vector>
using namespace std;

class Solution1 {
public:
    bool isPowerOfThree(int n) {
        return n > 0 && 1162261467 % n == 0;
    }
};

class Solution {
public:
    bool isPowerOfThree(int n) {
    	if(n<=0) return false;
        while(n!=1)
        {
        	if(n%3!=0) return false;
        	n/=3;
		}
		
		return true;
    }
};


int main()
{
	cout<<-1%3<<endl;
	return 0;
 } 
